<?php
/**
 * Created by PhpStorm.
 * User: zsd
 * Date: 2018/4/27
 * Time: 下午4:04
 */
namespace common\behaviors;

use yii\filters\auth\AuthMethod;

class ApiAuthBehaviors extends AuthMethod
{
    const TOKEN_PARAM = 'token';

    public function authenticate($user, $request, $response)
    {
        return $user->loginByAccessToken($request->getHeaders()[self::TOKEN_PARAM]);
    }
}
